import {baseAjax} from '../baseAjax'

// 获取角色列表
export function getRoleList (successHandle, failHandle) {
  baseAjax('/ent/role/list', {}, 'get', successHandle, failHandle)
}

// 通过Id获取角色
export function getRoleById (id, successHandle, failHandle) {
  let _url = '/ent/role/' + id
  baseAjax(_url, {}, 'get', successHandle, failHandle)
}

// 新增角色
export function addRole (data, successHandle, failHandle) {
  baseAjax('/ent/role/save', data, 'post', successHandle, failHandle)
}

// 修改角色
export function updateRole (data, successHandle, failHandle) {
  baseAjax('/ent/role', data, 'put', successHandle, failHandle)
}

// 删除角色
export function deleteRole (id, successHandle, failHandle) {
  let _url = '/ent/role/' + id
  baseAjax(_url, {}, 'delete', successHandle, failHandle)
}

// 获取部门信息
export function getDeptTreeList (data, successHandle, failHandle) {
  baseAjax('/tenant/tenantDeptInfo/tree', data, 'get', successHandle, failHandle)
}

// 获取功能列表信息
export function getFuncTreeList (data, successHandle, failHandle) {
  baseAjax('/ent/role/menu/tree', data, 'get', successHandle, failHandle)
}

// 获取菜单列表
export function getMenuList (successHandle, failHandle) {
  baseAjax('/ent/role/menu/list', {}, 'get', successHandle, failHandle)
}
